﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class WebControl_ShowBusTicket : System.Web.UI.UserControl
{
    ListAndProcessData wsv = new ListAndProcessData();
    private string search = null;
    private string status = null;
    private string check = null;
    protected void Page_Load(object sender, EventArgs e)
    {
         search = Request.QueryString["seach"];
         status = Request.QueryString["status"];
         check = Request.QueryString["Loi"];               
        try{
            if (check == "404")
            {
                lblnull.Visible = true;
            }
            else
            {
                var content = wsv.searchBucticket(search, status);
                if (content.Count != 0)
                {
                    ListView1.DataSource = content;
                    ListView1.DataBind();
                }
                else
                {

                    Response.Redirect("ShowBusticket_Admin.aspx?Loi=404");
                }
            }
        }
        catch (Exception)
        {
            ListView1.DataSource = wsv.getbusticket();
            ListView1.DataBind();
        }

        
        
    }
    protected void btnsearch_Click(object sender, EventArgs e)
    {
        if (check == "404")
        {
            Response.Redirect("ShowBusticket_Admin.aspx");
        }
        else
        {
            Response.Redirect("ShowBusticket_Admin.aspx?seach=" + txtcustomerName.Text + "&status=" + DropDownList1.SelectedValue);
        }
    }
}